package demon2;

class Car{
    public String name;
    public String color;
    public String GetName(){
        return name;
    }
    public String GetColor(){
        return color;
    }
    public Car(String name,String color){
        this.name=name;
        this.color=color;
    }
    public void Dive(){
        System.out.println(this.name+"正在行驶");
    }
    public Car Sign(){
        System.out.println(this.name+"的标志");
        return null;
    }
}
class Bmw extends Car {
    Car car = new Car("宝马", "蓝色");
    String name = car.GetName();
    String color = car.GetColor();
    @Override   //方法的重写
    public Bmw Sign(){
        System.out.println(this.name+"的标志是别摸我");
        return null;
    }
    //   @Override
//    public String GetName() {
//        return super.GetName();
//    }
    public Bmw(String name, String color) {
        super(name, color);
    }
}
class Benz extends Car{
    Car car=new Car("奔驰","黑色");
    String name= car.GetName();
    String color=car.GetColor();
    public Benz(String name,String color){
        super(name,color);
    }
    @Override
    public Bmw Sign(){
        System.out.println(this.name+"标志是三个杠加一个圆圈");
        return null;
    }
}

public class Test3 {
    public static void func(Car car){
        car.Sign();
    }
    public static Car func1(){
        return new Bmw("宝马","蓝色");
    }
    public static Car func2(){
        return new Benz("奔驰","黑色");
    }
    public static void main(String[] args) {
        Bmw bmw=new Bmw("宝马","蓝色");
        Benz benz=new Benz("奔驰","黑色");
        func(benz);
        func(bmw);
        func1().Sign();
        func2().Sign();
    }
}
